*STUDY 1: FL/IRMA EXPERIMENT

*clear
clear

*get data
use ".../study 1 data for replication.dta"

*extract vars needed for analysis
keep Q52a Q52b Q52c Q4 Q3 Q80 Q13 Q14_1 Q14_2 Q14_3 Q14_4 Q14_5 Q14_6 Q10a Q10a

*create factor variable for experimental condition
generate gouge=.
		*control
replace gouge=1 if Q52a !=.
tab Q52a
tab gouge
tab gouge Q52a	
		*stores might run out of goods
replace gouge=2 if Q52b !=.
tab Q52b
tab gouge
tab gouge Q52b
		*stores close
replace gouge=3 if Q52c !=.
tab Q52c
tab gouge
tab gouge Q52c
		*summary
label define gouge_label 1 "control" 2 "stores run out" 3 "stores close"
label values gouge gouge_label
tab gouge
summarize gouge

*create create factor variable for experimental condition, this time control vs all treats
generate gouge_pooled=.
		*control
replace gouge_pooled=1 if Q52a !=.
tab Q52a
tab gouge_pooled
tab gouge_pooled Q52a	
		*stores might run out of goods
replace gouge_pooled=2 if Q52b !=.
tab Q52b
tab gouge_pooled
tab gouge_pooled Q52b
		*stores close
replace gouge_pooled=2 if Q52c !=.
tab Q52c
tab gouge_pooled
tab gouge_pooled Q52c
		*summary
label define gouge_pooled_label 1 "control" 2 "treat pooled"
label values gouge_pooled gouge_pooled_label
tab gouge_pooled
summarize gouge_pooled

*balance analysis
	*clean up covariates
		*sex
tab Q4
generate female=.
replace female=0 if Q4==1
replace female=1 if Q4==2
tab Q4 female
		*age
encode Q3, generate(age)
tab age
		*income
tab Q80
generate income=.
replace income=1 if Q80==1
replace income=2 if Q80==2
replace income=3 if Q80==3
replace income=4 if Q80==5
replace income=5 if Q80==6
replace income=6 if Q80==7
replace income=7 if Q80==9
tab Q80 income
		*education
tab Q13
		*race
tab Q14_1
tab Q14_2
tab Q14_3
tab Q14_4
tab Q14_5
tab Q14_6
generate nonwhite=.
replace nonwhite=1 if Q14_1==.
replace nonwhite=0 if Q14_1==1
tab Q14_1 nonwhite
		*party id (based on first screener question)
tab Q10a
recode Q10a (1=1) (2=0) (3=0) (4=0), gen(pid_DEM)
recode Q10a (1=0) (2=1) (3=0) (4=0), gen(pid_REP)
tab Q10a pid_DEM
tab Q10a pid_REP
	*multinomial logit with control as base category
mlogit gouge female age income Q13 nonwhite pid_DEM pid_REP, b(1)
		*note: by adding PID gender now is sig for "stores close"

*combine and code y/n/dk on PRO anti-gouging law regardless of treatment (include DK responses; 3 = yes ban gouging, 1 = no don't, 2 = dk)
generate no_gouge_all=.
	*yes, support law
replace no_gouge_all=3 if Q52a==1 | Q52b==1 | Q52c==1
	*no, do not support law
replace no_gouge_all=1 if Q52a==2 | Q52b==2 | Q52c==2
	*dk
replace no_gouge_all=2 if Q52a==3 | Q52b==3 | Q52c==3
	*stats/check coding
tab Q52a
tab Q52b
tab Q52c
tab no_gouge_all

*create indicator whereby 1 = not sure and 0 = yes/no on the ban
generate dk_gouge=.
	*yes, support law
replace dk_gouge=0 if Q52a==1 | Q52b==1 | Q52c==1
	*no, do not support law
replace dk_gouge=0 if Q52a==2 | Q52b==2 | Q52c==2
	*dk
replace dk_gouge=1 if Q52a==3 | Q52b==3 | Q52c==3
	*stats/check coding
tab Q52a
tab Q52b
tab Q52c
tab dk_gouge

*combine and code y/n on PRO anti-gouging law regardless of treatment (dropping DK responses; 1 = yes ban gouging, 0 = no don't)
generate no_gouge_nodk=.
replace no_gouge_nodk=1 if Q52a==1
replace no_gouge_nodk=0 if Q52a==2
replace no_gouge_nodk=1 if Q52b==1
replace no_gouge_nodk=0 if Q52b==2
replace no_gouge_nodk=1 if Q52c==1
replace no_gouge_nodk=0 if Q52c==2
tab Q52a
tab Q52b
tab Q52c
tab no_gouge_nodk

*ANOVA
anova no_gouge_nodk gouge female
margins gouge
	*now run interacted w/ pid
anova no_gouge_nodk gouge##Q10a female

*for supplement: replicate analysis with the "not sure" respondents
	*not sure vs all other responses
anova dk_gouge gouge female
margins gouge

*****
*****

*STUDY 2: U-LINK U.S. DATA

*clear
clear

*get data
use ".../study 2 data for replication.dta"

*create factor variable for experimental condition
generate gouge=.
		*control
replace gouge=1 if q39 !=.
tab q39
tab gouge
tab gouge q39	
		*stores might run out of goods
replace gouge=2 if q41 !=.
tab q41
tab gouge
tab gouge q41
		*stores close
replace gouge=3 if q43 !=.
tab q43
tab gouge
tab gouge q43
		*stores might run out of goods + EXPERT
replace gouge=4 if q45 !=.
tab q45
tab gouge
tab gouge q45
		*stores close + EXPERT
replace gouge=5 if q46 !=.
tab q46
tab gouge
tab gouge q46
		*summary
label define gouge_label 1 "control" 2 "stores run out" 3 "stores close" 4 "stores run out + EXPERT " 5 "stores close + EXPERT" 
label values gouge gouge_label
tab gouge
summarize gouge

*create create factor variable for experimental condition, this time control vs all treats
generate gouge_pooled=.
		*control
replace gouge_pooled=1 if q39 !=.
tab q39
tab gouge_pooled
tab gouge_pooled q39	
		*stores might run out of goods
replace gouge_pooled=2 if q41 !=.
tab q41
tab gouge_pooled
tab gouge_pooled q41
		*stores close
replace gouge_pooled=2 if q43 !=.
tab q43
tab gouge_pooled
tab gouge_pooled q43
		*stores might run out of goods + EXPERT
replace gouge_pooled=2 if q45 !=.
tab q45
tab gouge_pooled
tab gouge_pooled q45
		*stores close + EXPERT
replace gouge_pooled=2 if q46 !=.
tab q46
tab gouge_pooled
tab gouge_pooled q46
		*summary
label define gouge_pooled_label 1 "control" 2 "treat pooled" 
label values gouge_pooled gouge_pooled_label
tab gouge_pooled
summarize gouge_pooled

*balance analysis
	*clean up covariates
		*sex
tab q1
generate female=.
replace female=0 if q1==1
replace female=1 if q1==2
tab q1 female
		*age
tab q5
			*convert yob to age
generate age=2020-q5
tab age
		*income
tab q4
		*education
tab q3
		*race
tab q2_1
tab q2_2
tab q2_3
tab q2_4
tab q2_5
tab q2_6
generate nonwhite=.
replace nonwhite=1 if q2_1==.
replace nonwhite=0 if q2_1==1
tab q2_1 nonwhite
tab q2_2 nonwhite
tab q2_3 nonwhite
tab q2_4 nonwhite
tab q2_5 nonwhite
tab q2_6 nonwhite
		*party id (based on first screener question)
tab q11a
recode q11a (1=1) (2=0) (3=0) (4=0), gen(pid_DEM)
recode q11a (1=0) (2=1) (3=0) (4=0), gen(pid_REP)
tab q11a pid_DEM
tab q11a pid_REP
	*multinomial logit with control as base category
mlogit gouge female age q4 q3 nonwhite pid_DEM pid_REP, b(1)

*combine and code y/n/dk on PRO anti-gouging law regardless of treatment (include DK responses; 3 = yes ban gouging, 1 = no don't, 2 = dk)
generate no_gouge_all=.
	*yes, supprt law
replace no_gouge_all=3 if q39==1 | q41==1 | q43==1 | q45==1 | q46==1
	*no, do not support law
replace no_gouge_all=1 if q39==2 | q41==2 | q43==2 | q45==2 | q46==2
	*dk
replace no_gouge_all=2 if q39==3 | q41==3 | q43==3 | q45==3 | q46==3
	*stats/check coding
tab q39
tab q41
tab q43
tab q45
tab q46
tab no_gouge_all
	*look at dk's by treatment condition
tab gouge no_gouge_all

*create indicator whereby 1 = not sure and 0 = yes/no on the ban
generate dk_gouge=.
	*yes, supprt law
replace dk_gouge=0 if q39==1 | q41==1 | q43==1 | q45==1 | q46==1
	*no, do not support law
replace dk_gouge=0 if q39==2 | q41==2 | q43==2 | q45==2 | q46==2
	*dk
replace dk_gouge=1 if q39==3 | q41==3 | q43==3 | q45==3 | q46==3
	*stats/check coding
tab q39
tab q41
tab q43
tab q45
tab q46
tab dk_gouge
	*look at dk's by treatment condition
tab gouge dk_gouge

*combine and code y/n on PRO anti-gouging law regardless of treatment (dropping DK responses; 1 = yes ban gouging, 0 = no don't)
generate no_gouge_nodk=.
replace no_gouge_nodk=1 if q39==1
replace no_gouge_nodk=0 if q39==2
replace no_gouge_nodk=1 if q41==1
replace no_gouge_nodk=0 if q41==2
replace no_gouge_nodk=1 if q43==1
replace no_gouge_nodk=0 if q43==2
replace no_gouge_nodk=1 if q45==1
replace no_gouge_nodk=0 if q45==2
replace no_gouge_nodk=1 if q46==1
replace no_gouge_nodk=0 if q46==2
tab q39
tab q41
tab q43
tab q45
tab q46
tab no_gouge_nodk

*ANOVA (note: controling for age [q5] and education [q3] due to imbalance in random assignemnt)
anova no_gouge_nodk gouge q5 q3
margins gouge
	*now run interacted w/ pid
anova no_gouge_nodk gouge##q11a q5 q3

*for reviewer, replicate the above ANOVA comparing the four treatments pooled to control
anova no_gouge_nodk gouge_pooled q5 q3

*for reviewer, repliace the ANOVA comparing the two non-expert treatments pooled to the two expert treatments pooled
	*make the IV
recode gouge (1=.) (2=0) (3=0) (4=1) (5=1), gen(gouge_expert_vs_no)
tab gouge gouge_expert_vs_no
	*analysis
anova no_gouge_nodk gouge_expert_vs_no q5 q3

*for reviewer (put in supplement): replicate analysis with the "not sure" respondents
	*not sure vs all other responses
anova dk_gouge gouge q5 q3
